package scauCmiScaffolding.compiled;

import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;

public class _jet_cmiCombinedConditionsEditor_0 implements JET2Template {
    private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$

    public _jet_cmiCombinedConditionsEditor_0() {
        super();
    }

    private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
    
    private static final TagInfo _td_c_get_1_9 = new TagInfo("c:get", //$NON-NLS-1$
            1, 9,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );

    public void generate(final JET2Context context, final JET2Writer __out) {
        JET2Writer out = __out;
        out.write("package ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_1_9 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_1_9); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_1_9.setRuntimeParent(null);
        _jettag_c_get_1_9.setTagInfo(_td_c_get_1_9);
        _jettag_c_get_1_9.doStart(context, out);
        _jettag_c_get_1_9.doEnd();
        out.write(".base.propertyEditor;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import java.beans.PropertyEditorSupport;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.ArrayList;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.List;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import org.springframework.stereotype.Controller;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("@Controller");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("public class CmiCombinedConditionsEditor extends PropertyEditorSupport{");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("\t@Override");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic  void setAsText(String  str) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tList<String> list = new ArrayList<>();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tif(str.length() > 0) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tstr = str.replaceAll(\",,\", \", ,\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tif(str.endsWith(\",\")) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tstr = str + \" \";");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tString[]  listString = str.split(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tfor(String string: listString) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tstr.trim();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tlist.add(string);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.setValue(list);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("}");  //$NON-NLS-1$        
        out.write(NL);         
    }
}
